﻿/*
 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

#ifndef BURNCTRLJLINK_H
#define BURNCTRLJLINK_H

#include "BurnCtrl.h"
#include "BurnCtrlJlinkWorker.h"

namespace BurnCtrlJLinkClass {
using namespace BurnCtrlJlinkWorkerClass;
class BurnCtrlJLink : public BurnCtrl {
    Q_OBJECT
public:
    BurnCtrlJLink(ChipType type, QObject *parent);
    ~BurnCtrlJLink() override;
    void InitBurnCmdByArray(const QMap<int, BIN_INFO> &infoArray) override;
    void StartConnect() override;
    void StartProWorker();
signals:
    void SignalEraseFlash();
    void SignalBurnFlash();
protected slots:
    void SlotCloseJlink() override;
    void SlotEraseFlashSuccess(const QString &str);
    void SlotEraseFlashFaild();
    void SlotBurnFlashSuccess();
    void SlotBurnFlashStr(const QString &str);
    void SlotBurnFlashFaild();
protected:
    void RemoveTempDir() const;
    void JlinkBs21WriteDtcm(const QString &saveDir) const;
    void MakeDir(const QString &path) const;
private:
    MyThreadClass::MyThread *proThread;
    BurnCtrlJlinkWorker *proWorker;
    int burnFlashCount;
    bool isStop;
};
}

#endif // BURNCTRLJLINK_H
